<template>
  <!-- 单个资讯 -->
  <div class="info-item">
    <img :src="information.imgUrl" alt="">
    <div class="right">
      <h4>{{information.title}}</h4>
      <p>
        <span class="author"><i class="el-icon-edit"></i> {{information.author}}</span>
        <span class="time"><i class="el-icon-time"></i>{{information.createTime}}</span>
      </p>
      <p>{{information.content}}</p>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'InfoItem',
    props: {
      information: Object
    }
  }
</script>

<style scoped>
  /* 给父容器固定高度，清除子元素浮动 */
  .info-item {
    height: 210px;
    background-color: #F2F3FF;
    border-radius: 5px;
    margin: 20px;
    padding: 20px;
  }

  img {
    float: left;
    width: 300px;
    border-radius: 10px;
    margin-right: 20px;
  }

  .right {
    letter-spacing: 2px;
    padding: 5px;
  }

  .right h4 {
    font-size: 18px;
    letter-spacing: 3px;
  }

  .right p {
    font-size: 16px;
    line-height: 30px;
    margin-left: 5px;
    /* 多行文本溢出隐藏 */
    display: -webkit-box;
    word-break: break-all;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-line;
  }

  .author {
    display: inline-block;
    color: #333;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 1px;
    margin-bottom: 8px;
    margin-left: 5px;
  }

  .el-icon-s-check {
    font-weight: 700;
  }

  .el-icon-time {
    vertical-align: middle;
  }

  .time {
    display: inline-block;
    color: #aaa;
    font-size: 10px;
    font-weight: 400;
    margin-left: 20px;
    margin-top: 10px;
  }
</style>